home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1994 March / Nautilus CD Magazine Volume 4-3 March 1994 Windows Edition.mdf / setup / nautcd / link / cserve.scr < prev    next >
Text File  |  1993-09-16  |  4KB  |  180 lines

  1. !
  2. !  Copyright (c) 1993
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !    Connect to CIS.
  10. !    First argument is %TRUE if direct connect and %FALSE otherwise
  11. !    Success:  returns %Success
  12. !    Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !        or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "3.1"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. show "Connecting to CompuServe Network";
  21. Tries = 7;
  22. on cancel goto Return_Cancel;
  23. FirstTry = %TRUE;
  24. FailStr = "";
  25. ETX = "^C";
  26. CompuServeHost = "CPS^M";
  27. ifndef %X121Address = "";
  28. ifndef %OKCmd = "";
  29. ifndef %StopAtHost = "";
  30.  
  31. Start_Connect:
  32.     if Tries = 0 goto CIS_Failure;
  33.     Tries = Tries - 1;
  34.  
  35. Connect_Wait:
  36.     wait
  37.         "UIC:"        goto Send_ETX,
  38.         "Host Name:"    goto Send_Host_Name,
  39.         "User ID:"    goto Send_ID,
  40.         "Password:"    goto Send_Password,
  41.         "XPAD"        goto Send_XPAD
  42.     until 80;
  43.  
  44.     if not DirectConnect goto Send_CR;
  45.     sendm "###";
  46.  
  47. Send_CR:
  48.     send %CR;
  49.     goto Start_Connect;
  50.  
  51. Send_ETX:
  52.     send ETX;
  53.     goto Connect_Wait;
  54.  
  55. Send_Host_Name:
  56.     if Arg2 goto No_Wait;
  57.     wait until 10;
  58. No_Wait:
  59.     if %StopAtHost = "" goto Send_No_Stop;
  60.     if %StopAtHost = "1" goto Return_Success;
  61.     send CompuServeHost;
  62.     goto Return_Success;
  63.  
  64. Send_No_Stop:
  65.     send CompuServeHost;
  66.     goto Connect_Wait;
  67.  
  68. Send_ID:
  69.     if %StopAtHost = "1" goto Force_Host;
  70.     show "Logging onto CompuServe";
  71.     send %UserID & %LogonParams & "/INT\" & %Password & %CR;
  72.     goto Logon_Wait;
  73.  
  74. Force_Host:
  75.     send "/HOST" & %CR;
  76.     goto Connect_Wait;
  77.  
  78. Send_XPAD:
  79.     send %X121Address & %CR;
  80.     goto Connect_Wait;
  81.  
  82. Send_Password:
  83.     send %Password;
  84.  
  85. Logon_Wait:
  86.     wait
  87.         "CompuServe"    goto Return_Success,
  88.         "^[[>"        goto Return_Success,
  89.         "^F"        goto Return_Success,
  90.         "? LOG"        goto Process_Log_Msg,
  91.         "??LOG"        goto Process_Log_Msg,
  92.         " NTW"        goto Logon_Failure,
  93.         "OK^M"        goto Send_OK_Cmd,
  94.         "^[I"        goto Send_Response
  95.     until 200;
  96.  
  97.     goto CIS_Failure;
  98.  
  99. Process_Log_Msg:
  100.     wait
  101.         "INE"    goto Bad_ID,
  102.         "ISX"    goto Bad_ID_Syntax,
  103.         "CAI"    goto Cannot_Auto_Irun,
  104.         "SIL"    goto System_Unavailable,
  105.         "SIU"    goto System_Unavailable,
  106.         "SNA"    goto System_Unavailable,
  107.         "STU"    goto System_Unavailable,
  108.         "UTL"    goto Too_Many_Users
  109.     until 50;
  110.  
  111.     goto Try_Again;
  112.  
  113. Too_Many_Users:
  114.     define %FailureMsg = "Simultaneous users exceeded";
  115.     exit %Failure;
  116.  
  117. Cannot_Auto_Irun:
  118.     define %FailureMsg = "Cannot Auto Irun HMI server";
  119.     exit %Failure;
  120.  
  121. Bad_ID:
  122.     FailStr = "Incorrect User ID or password";
  123.     goto Try_Again;
  124.  
  125. Bad_ID_Syntax:
  126.     FailStr = "Incorrect User ID syntax";
  127.     goto Try_Again;
  128.  
  129. System_Unavailable:
  130.     define %FailureMsg = "The system is unavailable, try again later";
  131.     exit %Fatal;
  132.  
  133. Try_Again:
  134.     if not FirstTry goto CIS_Fatal;
  135.     send ETX;
  136.     FirstTry = %FALSE;
  137.  
  138.     wait
  139.         "User ID"    goto Send_ID
  140.     until 140;
  141.  
  142.     goto CIS_Fatal;
  143.  
  144. Logon_Failure:
  145.     define %FailureMsg = "Remote is busy or unavailable";
  146.     exit %Fatal;
  147.  
  148. Send_OK_Cmd:
  149.     if %OKCmd = "" goto Logon_Wait;
  150.     send %OKCmd & %CR;
  151.     goto Logon_Wait;
  152.  
  153. Send_Response:
  154.     sendi %ESCIResponse;
  155.     exit %Success;
  156.  
  157. CIS_Failure:
  158.     if FailStr <> "" goto Return_Fail_Msg;
  159.     define %FailureMsg = "Unable to connect to CompuServe host";
  160.     exit %Failure;
  161.  
  162. CIS_Fatal:
  163.     if FailStr <> "" goto Return_Fatal_Msg;
  164.     define %FailureMsg = "Unable to connect to CompuServe host";
  165.     exit %Fatal;
  166.  
  167. Return_Fail_Msg:
  168.     define %FailureMsg = FailStr;
  169.     exit %Failure;
  170.  
  171. Return_Fatal_Msg:
  172.     define %FailureMsg = FailStr;
  173.     exit %Fatal;
  174.  
  175. Return_Success:
  176.     exit %Success;
  177.  
  178. Return_Cancel:
  179.     exit %Cancel;
  180.